/**
 * 组织架构的API
 */

import request from '@/utils/request'

/**
 * @description 查询企业的部门列表
 * @returns
 */
export function getDepartmentListAPI() {
  return request({
    url: '/company/department',
    method: 'GET'
  })
}

/**
 * @description 获取简单的员工列表
 * @returns
 */
export function getEmployeeSimpleAPI() {
  return request({
    url: '/sys/user/simple',
    method: 'GET'
  })
}

/**
 * @description 新增部门
 * @param {*} data
 * @returns
 */
export function addDepartmentsAPI(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

/**
 * @description 根据ID查询部门详情
 * @param {*} id  当前部门id
 * @returns
 */
export function getDepartDetailAPI(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'GET'
  })
}

/**
 *@description 根据ID修改部门详情
 * @param {*} id 当前部门id
 * @param {*} data 修改后的数据
 * @returns
 */
export function updateDepartmentsAPI(id, data) {
  return request({
    url: `/company/department/${id}`,
    method: 'PUT',
    data
  })
}

/**
 * @description 根据ID删除部门
 * @param {*} id  当前的部门id
 * @returns
 */
export function delDepartmentAPI(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'DELETE'
  })
}
